From a2d1299475cb8f34f99e420ef752bf9366275bf7 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Fri, 2 Feb 2001 22:19:31 +0000 Subject: [PATCH] Make gdk_colormap_sync private since it was never exported in a header Fri Feb 2 17:16:09 2001 Owen Taylor * gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make gdk_colormap_sync private since it was never exported in a header file. * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in colormap->colors[] for StaticGray, StaticColor colormaps. * gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp was being used as if it was image->bits_per_pixel. * gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel for the image in the GdkImage structure since it isn't reconstructable, and we need it to handle packed types * gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making the assumption that on Win32 image->bits_per_pixel == image->depth, always. * gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel. * gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative warning message if no converter can be found. --- ChangeLog | 33 +++++++++++++++++++++++++++++++++ ChangeLog.pre-2-0 | 33 +++++++++++++++++++++++++++++++++ ChangeLog.pre-2-10 | 33 +++++++++++++++++++++++++++++++++ ChangeLog.pre-2-2 | 33 +++++++++++++++++++++++++++++++++ ChangeLog.pre-2-4 | 33 +++++++++++++++++++++++++++++++++ ChangeLog.pre-2-6 | 33 +++++++++++++++++++++++++++++++++ ChangeLog.pre-2-8 | 33 +++++++++++++++++++++++++++++++++ examples/packer/pack.c | 38 +++++++++++++++++++------------------- gdk/gdkimage.h | 5 +++-- gdk/gdkpixbuf-drawable.c | 13 +++++++------ gdk/gdkrgb.c | 18 +++++++++++------- gdk/linux-fb/gdkimage-fb.c | 13 ++++++++----- gdk/win32/gdkimage-win32.c | 3 +++ gdk/x11/gdkcolor-x11.c | 28 +++++++++++++++++++++------- gdk/x11/gdkimage-x11.c | 12 ++++-------- gtk/fnmatch.c | 4 ++-- 16 files changed, 309 insertions(+), 56 deletions(-) diff --git a/ChangeLog b/ChangeLog index a37e7e993b..cf3e71877a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +Fri Feb 2 17:16:09 2001 Owen Taylor + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make + gdk_colormap_sync private since it was never exported + in a header file. + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in + colormap->colors[] for StaticGray, StaticColor colormaps. + + * gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp + was being used as if it was image->bits_per_pixel. + + * gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel + for the image in the GdkImage structure since it isn't + reconstructable, and we need it to handle packed types + + * gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making + the assumption that on Win32 image->bits_per_pixel == image->depth, + always. + + * gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel. + + * gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative + warning message if no converter can be found. + +Fri Feb 2 15:09:51 2001 Owen Taylor + + * gtk/fnmatch.c (FOLD): Fix problem with passing signed + chars to isupper() / tolower(). (#567) + + * examples/packer/pack.c: Add GINT_TO_POINTER, GPOINTER_TO_INT + to clear up 64-bit warnings. (#567) + Fri Feb 2 12:26:50 2001 Owen Taylor * gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index a37e7e993b..cf3e71877a 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,36 @@ +Fri Feb 2 17:16:09 2001 Owen Taylor + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make + gdk_colormap_sync private since it was never exported + in a header file. + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in + colormap->colors[] for StaticGray, StaticColor colormaps. + + * gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp + was being used as if it was image->bits_per_pixel. + + * gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel + for the image in the GdkImage structure since it isn't + reconstructable, and we need it to handle packed types + + * gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making + the assumption that on Win32 image->bits_per_pixel == image->depth, + always. + + * gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel. + + * gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative + warning message if no converter can be found. + +Fri Feb 2 15:09:51 2001 Owen Taylor + + * gtk/fnmatch.c (FOLD): Fix problem with passing signed + chars to isupper() / tolower(). (#567) + + * examples/packer/pack.c: Add GINT_TO_POINTER, GPOINTER_TO_INT + to clear up 64-bit warnings. (#567) + Fri Feb 2 12:26:50 2001 Owen Taylor * gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a37e7e993b..cf3e71877a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,36 @@ +Fri Feb 2 17:16:09 2001 Owen Taylor + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make + gdk_colormap_sync private since it was never exported + in a header file. + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in + colormap->colors[] for StaticGray, StaticColor colormaps. + + * gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp + was being used as if it was image->bits_per_pixel. + + * gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel + for the image in the GdkImage structure since it isn't + reconstructable, and we need it to handle packed types + + * gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making + the assumption that on Win32 image->bits_per_pixel == image->depth, + always. + + * gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel. + + * gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative + warning message if no converter can be found. + +Fri Feb 2 15:09:51 2001 Owen Taylor + + * gtk/fnmatch.c (FOLD): Fix problem with passing signed + chars to isupper() / tolower(). (#567) + + * examples/packer/pack.c: Add GINT_TO_POINTER, GPOINTER_TO_INT + to clear up 64-bit warnings. (#567) + Fri Feb 2 12:26:50 2001 Owen Taylor * gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index a37e7e993b..cf3e71877a 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,36 @@ +Fri Feb 2 17:16:09 2001 Owen Taylor + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make + gdk_colormap_sync private since it was never exported + in a header file. + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in + colormap->colors[] for StaticGray, StaticColor colormaps. + + * gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp + was being used as if it was image->bits_per_pixel. + + * gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel + for the image in the GdkImage structure since it isn't + reconstructable, and we need it to handle packed types + + * gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making + the assumption that on Win32 image->bits_per_pixel == image->depth, + always. + + * gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel. + + * gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative + warning message if no converter can be found. + +Fri Feb 2 15:09:51 2001 Owen Taylor + + * gtk/fnmatch.c (FOLD): Fix problem with passing signed + chars to isupper() / tolower(). (#567) + + * examples/packer/pack.c: Add GINT_TO_POINTER, GPOINTER_TO_INT + to clear up 64-bit warnings. (#567) + Fri Feb 2 12:26:50 2001 Owen Taylor * gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index a37e7e993b..cf3e71877a 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,36 @@ +Fri Feb 2 17:16:09 2001 Owen Taylor + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make + gdk_colormap_sync private since it was never exported + in a header file. + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in + colormap->colors[] for StaticGray, StaticColor colormaps. + + * gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp + was being used as if it was image->bits_per_pixel. + + * gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel + for the image in the GdkImage structure since it isn't + reconstructable, and we need it to handle packed types + + * gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making + the assumption that on Win32 image->bits_per_pixel == image->depth, + always. + + * gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel. + + * gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative + warning message if no converter can be found. + +Fri Feb 2 15:09:51 2001 Owen Taylor + + * gtk/fnmatch.c (FOLD): Fix problem with passing signed + chars to isupper() / tolower(). (#567) + + * examples/packer/pack.c: Add GINT_TO_POINTER, GPOINTER_TO_INT + to clear up 64-bit warnings. (#567) + Fri Feb 2 12:26:50 2001 Owen Taylor * gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index a37e7e993b..cf3e71877a 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,36 @@ +Fri Feb 2 17:16:09 2001 Owen Taylor + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make + gdk_colormap_sync private since it was never exported + in a header file. + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in + colormap->colors[] for StaticGray, StaticColor colormaps. + + * gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp + was being used as if it was image->bits_per_pixel. + + * gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel + for the image in the GdkImage structure since it isn't + reconstructable, and we need it to handle packed types + + * gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making + the assumption that on Win32 image->bits_per_pixel == image->depth, + always. + + * gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel. + + * gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative + warning message if no converter can be found. + +Fri Feb 2 15:09:51 2001 Owen Taylor + + * gtk/fnmatch.c (FOLD): Fix problem with passing signed + chars to isupper() / tolower(). (#567) + + * examples/packer/pack.c: Add GINT_TO_POINTER, GPOINTER_TO_INT + to clear up 64-bit warnings. (#567) + Fri Feb 2 12:26:50 2001 Owen Taylor * gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index a37e7e993b..cf3e71877a 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,36 @@ +Fri Feb 2 17:16:09 2001 Owen Taylor + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_sync): Make + gdk_colormap_sync private since it was never exported + in a header file. + + * gdk/x11/gdkcolor-x11.c (gdk_colormap_new): Fill in + colormap->colors[] for StaticGray, StaticColor colormaps. + + * gdk/gdkpixbuf-drawable.c: Fix problems where image->bpp + was being used as if it was image->bits_per_pixel. + + * gdk/gdkimage.h, gdk/x11/gdkimage-x11.c: Save the bits-per-pixel + for the image in the GdkImage structure since it isn't + reconstructable, and we need it to handle packed types + + * gdk/win32/gdkimage-win32.c: Set image->bits_per_pixel. (I'm making + the assumption that on Win32 image->bits_per_pixel == image->depth, + always. + + * gdk/linux-fb/gdkimage-fb.c: Set image->bits_per_pixel. + + * gdk/gdkrgb.c (gdk_rgb_select_conv): Exit with an informative + warning message if no converter can be found. + +Fri Feb 2 15:09:51 2001 Owen Taylor + + * gtk/fnmatch.c (FOLD): Fix problem with passing signed + chars to isupper() / tolower(). (#567) + + * examples/packer/pack.c: Add GINT_TO_POINTER, GPOINTER_TO_INT + to clear up 64-bit warnings. (#567) + Fri Feb 2 12:26:50 2001 Owen Taylor * gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of diff --git a/examples/packer/pack.c b/examples/packer/pack.c index 6bde2f082b..e8e3af4873 100644 --- a/examples/packer/pack.c +++ b/examples/packer/pack.c @@ -159,10 +159,10 @@ main (int argv, char **argc) button_left = gtk_toggle_button_new_with_label("Left"); button_right = gtk_toggle_button_new_with_label("Right"); - gtk_object_set_data(GTK_OBJECT(button_top), "side", (gpointer) GTK_SIDE_TOP); - gtk_object_set_data(GTK_OBJECT(button_bottom), "side", (gpointer) GTK_SIDE_BOTTOM); - gtk_object_set_data(GTK_OBJECT(button_left), "side", (gpointer) GTK_SIDE_LEFT); - gtk_object_set_data(GTK_OBJECT(button_right), "side", (gpointer) GTK_SIDE_RIGHT); + gtk_object_set_data(GTK_OBJECT(button_top), "side", GINT_TO_POINTER (GTK_SIDE_TOP)); + gtk_object_set_data(GTK_OBJECT(button_bottom), "side", GINT_TO_POINTER (GTK_SIDE_BOTTOM)); + gtk_object_set_data(GTK_OBJECT(button_left), "side", GINT_TO_POINTER (GTK_SIDE_LEFT)); + gtk_object_set_data(GTK_OBJECT(button_right), "side", GINT_TO_POINTER (GTK_SIDE_RIGHT)); gtk_widget_set_usize(button_top, 50, -1); gtk_widget_set_usize(button_bottom, 50, -1); @@ -230,15 +230,15 @@ main (int argv, char **argc) button_sw = gtk_toggle_button_new_with_label("SW"); button_center = gtk_toggle_button_new_with_label(""); - gtk_object_set_data(GTK_OBJECT(button_n), "anchor", (gpointer) GTK_ANCHOR_N); - gtk_object_set_data(GTK_OBJECT(button_nw), "anchor", (gpointer) GTK_ANCHOR_NW); - gtk_object_set_data(GTK_OBJECT(button_ne), "anchor", (gpointer) GTK_ANCHOR_NE); - gtk_object_set_data(GTK_OBJECT(button_s), "anchor", (gpointer) GTK_ANCHOR_S); - gtk_object_set_data(GTK_OBJECT(button_sw), "anchor", (gpointer) GTK_ANCHOR_SW); - gtk_object_set_data(GTK_OBJECT(button_se), "anchor", (gpointer) GTK_ANCHOR_SE); - gtk_object_set_data(GTK_OBJECT(button_w), "anchor", (gpointer) GTK_ANCHOR_W); - gtk_object_set_data(GTK_OBJECT(button_e), "anchor", (gpointer) GTK_ANCHOR_E); - gtk_object_set_data(GTK_OBJECT(button_center), "anchor", (gpointer) GTK_ANCHOR_CENTER); + gtk_object_set_data(GTK_OBJECT(button_n), "anchor", GINT_TO_POINTER (GTK_ANCHOR_N)); + gtk_object_set_data(GTK_OBJECT(button_nw), "anchor", GINT_TO_POINTER (GTK_ANCHOR_NW)); + gtk_object_set_data(GTK_OBJECT(button_ne), "anchor", GINT_TO_POINTER (GTK_ANCHOR_NE)); + gtk_object_set_data(GTK_OBJECT(button_s), "anchor", GINT_TO_POINTER (GTK_ANCHOR_S)); + gtk_object_set_data(GTK_OBJECT(button_sw), "anchor", GINT_TO_POINTER (GTK_ANCHOR_SW)); + gtk_object_set_data(GTK_OBJECT(button_se), "anchor", GINT_TO_POINTER (GTK_ANCHOR_SE)); + gtk_object_set_data(GTK_OBJECT(button_w), "anchor", GINT_TO_POINTER (GTK_ANCHOR_W)); + gtk_object_set_data(GTK_OBJECT(button_e), "anchor", GINT_TO_POINTER (GTK_ANCHOR_E)); + gtk_object_set_data(GTK_OBJECT(button_center), "anchor", GINT_TO_POINTER (GTK_ANCHOR_CENTER)); gtk_signal_connect (GTK_OBJECT (button_n), "toggled", GTK_SIGNAL_FUNC (toggle_anchor), (gpointer) info); @@ -321,9 +321,9 @@ main (int argv, char **argc) GTK_FILL_X | GTK_PACK_EXPAND, 0, 10, 5, 0, 0); - gtk_object_set_data(GTK_OBJECT(button_fillx), "option", (gpointer) GTK_FILL_X); - gtk_object_set_data(GTK_OBJECT(button_filly), "option", (gpointer) GTK_FILL_Y); - gtk_object_set_data(GTK_OBJECT(button_expand), "option", (gpointer) GTK_PACK_EXPAND); + gtk_object_set_data(GTK_OBJECT(button_fillx), "option", GINT_TO_POINTER (GTK_FILL_X)); + gtk_object_set_data(GTK_OBJECT(button_filly), "option", GINT_TO_POINTER (GTK_FILL_Y)); + gtk_object_set_data(GTK_OBJECT(button_expand), "option", GINT_TO_POINTER (GTK_PACK_EXPAND)); gtk_signal_connect (GTK_OBJECT (button_fillx), "toggled", GTK_SIGNAL_FUNC (toggle_options), (gpointer) info); @@ -373,7 +373,7 @@ toggle_options (GtkWidget *widget, gpointer data) info = (Info*) data; - option = (gint) gtk_object_get_data(GTK_OBJECT(widget), "option"); + option = GPOINTER_TO_INT (gtk_object_get_data(GTK_OBJECT(widget), "option")); pchild = info->pchild; if (pchild == NULL) { @@ -412,7 +412,7 @@ toggle_anchor (GtkWidget *widget, gpointer data) info = (Info*) data; if (GTK_TOGGLE_BUTTON(widget)->active) { - anchor = (gint) gtk_object_get_data(GTK_OBJECT(widget), "anchor"); + anchor = GPOINTER_TO_INT (gtk_object_get_data(GTK_OBJECT(widget), "anchor")); pchild = info->pchild; if (pchild == NULL) { @@ -483,7 +483,7 @@ toggle_side (GtkWidget *widget, gpointer data) if (GTK_TOGGLE_BUTTON(widget)->active) { - side = (gint) gtk_object_get_data(GTK_OBJECT(widget), "side"); + side = GPOINTER_TO_INT (gtk_object_get_data(GTK_OBJECT(widget), "side")); pchild = info->pchild; if (pchild == NULL) { diff --git a/gdk/gdkimage.h b/gdk/gdkimage.h index 16bf59d609..2c631b3560 100644 --- a/gdk/gdkimage.h +++ b/gdk/gdkimage.h @@ -44,8 +44,9 @@ struct _GdkImage gint width; gint height; guint16 depth; - guint16 bpp; /* bytes per pixel */ - guint16 bpl; /* bytes per line */ + guint16 bpp; /* bytes per pixel */ + guint16 bpl; /* bytes per line */ + guint16 bits_per_pixel; /* bits per pixel */ gpointer mem; gpointer windowing_data; diff --git a/gdk/gdkpixbuf-drawable.c b/gdk/gdkpixbuf-drawable.c index 776ebe6067..97539a0e5f 100644 --- a/gdk/gdkpixbuf-drawable.c +++ b/gdk/gdkpixbuf-drawable.c @@ -1078,7 +1078,7 @@ rgbconvert (GdkImage *image, GdkVisual *v = gdk_colormap_get_visual(cmap); d(printf("masks = %x:%x:%x\n", v->red_mask, v->green_mask, v->blue_mask)); - d(printf("image depth = %d, bpp = %d\n", image->depth, image->bpp)); + d(printf("image depth = %d, bits per pixel = %d\n", image->depth, image->bits_per_pixel)); switch (v->type) { @@ -1087,13 +1087,14 @@ rgbconvert (GdkImage *image, case GDK_VISUAL_GRAYSCALE: case GDK_VISUAL_STATIC_COLOR: case GDK_VISUAL_PSEUDO_COLOR: - switch (image->bpp) + switch (image->bits_per_pixel) { case 1: bank = 0; break; case 8: - bank = 1; + if (image->depth == 8) + bank = 1; break; } break; @@ -1102,18 +1103,18 @@ rgbconvert (GdkImage *image, { case 15: if (v->red_mask == 0x7c00 && v->green_mask == 0x3e0 && v->blue_mask == 0x1f - && image->bpp == 16) + && image->bits_per_pixel == 16) bank = 2; break; case 16: if (v->red_mask == 0xf800 && v->green_mask == 0x7e0 && v->blue_mask == 0x1f - && image->bpp == 16) + && image->bits_per_pixel == 16) bank = 3; break; case 24: case 32: if (v->red_mask == 0xff0000 && v->green_mask == 0xff00 && v->blue_mask == 0xff - && image->bpp == 32) + && image->bits_per_pixel == 32) bank = 4; break; } diff --git a/gdk/gdkrgb.c b/gdk/gdkrgb.c index aa24b3cfa8..600d1f3b7d 100644 --- a/gdk/gdkrgb.c +++ b/gdk/gdkrgb.c @@ -2872,13 +2872,7 @@ gdk_rgb_select_conv (GdkRgbInfo *image_info, GdkImage *image) depth = image_info->visual->depth; - /* FIXME: save the bpp in the image; this is hack that works for - * common visuals, not otherwise. - */ - if (depth <= 8) - bpp = depth; - else - bpp = 8 * image->bpp; + bpp = image->bits_per_pixel; byte_order = image->byte_order; if (gdk_rgb_verbose) @@ -3031,6 +3025,16 @@ gdk_rgb_select_conv (GdkRgbInfo *image_info, GdkImage *image) conv_d = gdk_rgb_convert_gray4_d_pack; } + if (!conv) + { + g_warning ("Visual type=%s depth=%d, image bpp=%d, %s first\n" + "is not supported by GdkRGB. Please submit a bug report\n" + "with the above values to bugzilla.gnome.org", + visual_names[vtype], depth, bpp, + byte_order == GDK_LSB_FIRST ? "lsb" : "msb"); + exit (1); + } + if (conv_d == NULL) conv_d = conv; diff --git a/gdk/linux-fb/gdkimage-fb.c b/gdk/linux-fb/gdkimage-fb.c index 3c112fe60a..81251ff2e0 100644 --- a/gdk/linux-fb/gdkimage-fb.c +++ b/gdk/linux-fb/gdkimage-fb.c @@ -122,6 +122,7 @@ gdk_image_new_bitmap(GdkVisual *visual, image->depth = 1; image->byte_order = 1 /* MSBFirst */; + image->bits_per_pixel = 1; image->bpp = 1; image->bpl = (w+7)/8; image->mem = g_malloc (image->bpl * h / 8); @@ -148,6 +149,7 @@ gdk_image_new (GdkImageType type, image->depth = visual->depth; image->byte_order = 0; + image->bits_per_pixel = image->depth; image->bpp = image->depth/8; image->bpl = (width * image->depth + 7) / 8; image->mem = g_malloc (image->bpl * height); @@ -164,7 +166,7 @@ _gdk_fb_get_image (GdkDrawable *drawable, { GdkImage *image; GdkImagePrivateFB *private; - gint bits_per_pixel = GDK_DRAWABLE_IMPL_FBDATA (gdk_parent_root)->depth; + gint bits_per_pixel = GdkPixmapFBData fbd; g_return_val_if_fail (drawable != NULL, NULL); @@ -176,13 +178,14 @@ _gdk_fb_get_image (GdkDrawable *drawable, image->visual = gdk_drawable_get_visual (drawable); image->width = width; image->height = height; - image->depth = bits_per_pixel; + image->bits_per_pixel = GDK_DRAWABLE_IMPL_FBDATA (gdk_parent_root)->depth; + image->depth = image->bits_per_pixel; - if (bits_per_pixel <= 8) + if (image->bits_per_pixel <= 8) image->bpp = 1; - else if (bits_per_pixel <= 16) + else if (image->bits_per_pixel <= 16) image->bpp = 2; - else if (bits_per_pixel <= 24) + else if (image->bits_per_pixel <= 24) image->bpp = 3; else image->bpp = 4; diff --git a/gdk/win32/gdkimage-win32.c b/gdk/win32/gdkimage-win32.c index 65ada9d6ea..32c05702f5 100644 --- a/gdk/win32/gdkimage-win32.c +++ b/gdk/win32/gdkimage-win32.c @@ -180,6 +180,7 @@ gdk_image_new_bitmap (GdkVisual *visual, image->bpl = bpl32; image->byte_order = GDK_MSB_FIRST; + image->bits_per_pixel = 1; image->bpp = 1; return(image); } /* gdk_image_new_bitmap() */ @@ -307,6 +308,7 @@ gdk_image_new (GdkImageType type, g_warning ("gdk_image_new: depth = %d", image->depth); g_assert_not_reached (); } + image->bits_per_pixel = image->depth; image->byte_order = GDK_LSB_FIRST; if (image->depth == 1) image->bpl = ((width-1)/32 + 1)*4; @@ -547,6 +549,7 @@ _gdk_win32_get_image (GdkDrawable *drawable, g_warning ("gdk_image_get: image->depth = %d", image->depth); g_assert_not_reached (); } + image->bits_per_pixel = image->depth; image->byte_order = GDK_LSB_FIRST; if (image->depth == 1) image->bpl = ((width - 1)/32 + 1)*4; diff --git a/gdk/x11/gdkcolor-x11.c b/gdk/x11/gdkcolor-x11.c index a20a302d72..d18e8073c9 100644 --- a/gdk/x11/gdkcolor-x11.c +++ b/gdk/x11/gdkcolor-x11.c @@ -212,6 +212,14 @@ gdk_colormap_new (GdkVisual *visual, case GDK_VISUAL_STATIC_GRAY: case GDK_VISUAL_STATIC_COLOR: + private->private_val = FALSE; + private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window, + xvisual, AllocNone); + + colormap->colors = g_new (GdkColor, colormap->size); + gdk_colormap_sync (colormap); + break; + case GDK_VISUAL_TRUE_COLOR: private->private_val = FALSE; private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window, @@ -226,7 +234,7 @@ gdk_colormap_new (GdkVisual *visual, #define MIN_SYNC_TIME 2 -void +static void gdk_colormap_sync (GdkColormap *colormap, gboolean force) { @@ -249,7 +257,7 @@ gdk_colormap_sync (GdkColormap *colormap, for (i = 0; i < colormap->size; i++) { - if (private->info[i].ref_count == 0) + if (!private->info || private->info[i].ref_count == 0) { xpalette[nlookup].pixel = i; xpalette[nlookup].red = 0; @@ -297,16 +305,22 @@ gdk_colormap_get_system (void) colormap->colors = NULL; colormap->size = colormap->visual->colormap_size; - if ((colormap->visual->type == GDK_VISUAL_GRAYSCALE) || - (colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR)) + switch (colormap->visual->type) { + case GDK_VISUAL_GRAYSCALE: + case GDK_VISUAL_PSEUDO_COLOR: private->info = g_new0 (GdkColorInfo, colormap->size); - colormap->colors = g_new (GdkColor, colormap->size); - private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash, (GEqualFunc) gdk_color_equal); - + /* Fall through */ + case GDK_VISUAL_STATIC_GRAY: + case GDK_VISUAL_STATIC_COLOR: + colormap->colors = g_new (GdkColor, colormap->size); gdk_colormap_sync (colormap, TRUE); + + case GDK_VISUAL_DIRECT_COLOR: + case GDK_VISUAL_TRUE_COLOR: + break; } gdk_colormap_add (colormap); diff --git a/gdk/x11/gdkimage-x11.c b/gdk/x11/gdkimage-x11.c index 1eeee22975..cfdb569ca5 100644 --- a/gdk/x11/gdkimage-x11.c +++ b/gdk/x11/gdkimage-x11.c @@ -155,6 +155,7 @@ gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h) image->width = w; image->height = h; image->depth = 1; + image->bits_per_pixel = 1; xvisual = ((GdkVisualPrivate*) visual)->xvisual; private->ximage = XCreateImage(private->xdisplay, xvisual, 1, XYBitmap, 0, 0, w ,h, 8, 0); @@ -364,6 +365,7 @@ gdk_image_new (GdkImageType type, image->mem = private->ximage->data; image->bpl = private->ximage->bytes_per_line; image->bpp = (private->ximage->bits_per_pixel + 7) / 8; + image->bits_per_pixel = private->ximage->bits_per_pixel; } } @@ -415,14 +417,8 @@ _gdk_x11_get_image (GdkDrawable *drawable, image->mem = private->ximage->data; image->bpl = private->ximage->bytes_per_line; - if (private->ximage->bits_per_pixel <= 8) - image->bpp = 1; - else if (private->ximage->bits_per_pixel <= 16) - image->bpp = 2; - else if (private->ximage->bits_per_pixel <= 24) - image->bpp = 3; - else - image->bpp = 4; + image->bits_per_pixel = private->ximage->bits_per_pixel; + image->bpp = (private->ximage->bits_per_pixel + 7) / 8; image->byte_order = private->ximage->byte_order; return image; diff --git a/gtk/fnmatch.c b/gtk/fnmatch.c index 79065e6cd7..b4ba3c7f0d 100644 --- a/gtk/fnmatch.c +++ b/gtk/fnmatch.c @@ -68,9 +68,9 @@ fnmatch (pattern, string, flags) /* Note that this evalutes C many times. */ #if !defined(G_OS_WIN32) && !defined(G_WITH_CYGWIN) -#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c)) +#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper ((unsigned char )(c)) ? tolower ((unsigned char)(c)) : (c)) #else -#define FOLD(c) (tolower (c)) +#define FOLD(c) (tolower ((unsigned char)(c))) #endif while ((c = *p++) != '\0') -- 2.30.2